package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TableTimeCardManagementMapper;
import com.ruoyi.system.domain.TableTimeCardManagement;
import com.ruoyi.system.service.ITableTimeCardManagementService;

/**
 * 桌台时长卡管理，记录时长卡的基础信息、有效期、使用规则及销售配置Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-21
 */
@Service
public class TableTimeCardManagementServiceImpl implements ITableTimeCardManagementService
{
    @Autowired
    private TableTimeCardManagementMapper tableTimeCardManagementMapper;

    /**
     * 通过id查询桌台时长卡管理
     *
     * @param id 桌台时长卡管理，记录时长卡的基础信息、有效期、使用规则及销售配置主键
     * @return 桌台时长卡管理，记录时长卡的基础信息、有效期、使用规则及销售配置
     */
    @Override
    public TableTimeCardManagement selectTableTimeCardManagementById(Long id)
    {
        return tableTimeCardManagementMapper.selectTableTimeCardManagementById(id);
    }

    /**
     * 查询桌台时长卡管理列表
     *
     * @param cardName,status 时长卡名称，时长卡状态
     * @return 桌台时长卡管理，记录时长卡的基础信息、有效期、使用规则及销售配置
     */
    @Override
    public List<TableTimeCardManagement> selectTableTimeCardManagementListByConditions(String cardName, String status)
    {
        return tableTimeCardManagementMapper.selectTableTimeCardManagementListByConditions(cardName,status);
    }

    /**
     * 新增桌台时长卡管理
     *
     * @param tableTimeCardManagement 桌台时长卡管理，记录时长卡的基础信息、有效期、使用规则及销售配置
     * @return 结果
     */
    @Override
    public int insertTableTimeCardManagement(TableTimeCardManagement tableTimeCardManagement)
    {
        tableTimeCardManagement.setCreateTime(DateUtils.getNowDate());
        return tableTimeCardManagementMapper.insertTableTimeCardManagement(tableTimeCardManagement);
    }

    /**
     * 修改桌台时长卡管理
     *
     * @param tableTimeCardManagement 桌台时长卡管理，记录时长卡的基础信息、有效期、使用规则及销售配置
     * @return 结果
     */
    @Override
    public int updateTableTimeCardManagement(TableTimeCardManagement tableTimeCardManagement)
    {
        tableTimeCardManagement.setUpdateTime(DateUtils.getNowDate());
        return tableTimeCardManagementMapper.updateTableTimeCardManagement(tableTimeCardManagement);
    }

    /**
     * 通过id批量删除桌台时长卡管理信息
     *
     * @param ids 需要删除的桌台时长卡管理，记录时长卡的基础信息、有效期、使用规则及销售配置主键
     * @return 结果
     */
    @Override
    public int deleteTableTimeCardManagementByIds(Long[] ids)
    {
        return tableTimeCardManagementMapper.deleteTableTimeCardManagementByIds(ids);
    }

    /**
     * 通过id删除桌台时长卡管理信息
     *
     * @param id 桌台时长卡管理，记录时长卡的基础信息、有效期、使用规则及销售配置主键
     * @return 结果
     */
    @Override
    public int deleteTableTimeCardManagementById(Long id)
    {
        return tableTimeCardManagementMapper.deleteTableTimeCardManagementById(id);
    }
}
